<template>
  <div class="newslist">
    <van-card
      v-for="item in newslist"
      :key="item.id"
      :title="item.title"
      :thumb="item.img_url"
      :thumb-link="'#/home/newsinfo/'+item.id"
    >
      <template #price>
        <span>{{item.add_time}}</span>
      </template>
      <template #num>
        <span>点击{{item.click}}次</span>
      </template>
    </van-card>
  </div>
</template>
<script>
export default {
  data() {
    return {
      newslist: []
    }
  },
  methods: {
    async getNewsList() {
      const res = await this.$http.getNewsList()
      this.newslist = res.data.message
    }
    // goDetail(id) {
    //   this.$router.push('/home/newsinfo/' + id)
    // }
  },
  created() {
    this.getNewsList()
  }
}
</script>
<style lang="scss" scoped>
.newslist {
  .van-card__content {
    min-height: 55px;
  }
  .van-card__thumb {
    height: 55px;
  }
  .van-card__price {
    color: red;
  }
  .van-card__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }
}
</style>
